package com.beidouapp.manager.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.beidouapp.dao.DrugReferenceMapper;
import com.beidouapp.domain.pojo.DrugReference;
import com.beidouapp.manager.DrugsManager;

@Repository
public class DrugsManagerImpl implements DrugsManager {
	 
	@Autowired
	DrugReferenceMapper drugReferenceMapper;

    @Override
    public List<DrugReference> findDrugsList(Map<String, Object> map) {
         
        return drugReferenceMapper.findDrugsList(map);
    }

    @Override
    public void insert(DrugReference drugReference) {
        drugReferenceMapper.insert(drugReference);
    }

    @Override
    public void update(DrugReference drugReference) {
        drugReferenceMapper.updateByPrimaryKeySelective(drugReference);
    }

    @Override
    public DrugReference getDrugDetailById(String id) {
         
        return drugReferenceMapper.selectByPrimaryKey(id);
    }

	@Override
	public List<DrugReference> findDrugsByMap(Map<String, Object> params,
			Integer offset, Integer limit) {
		return drugReferenceMapper.findDrugsByMap(new RowBounds(offset, limit), params);
	}

	@Override
	public Integer findDrugsCountByMap(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return drugReferenceMapper.findDrugsCountByMap(params);
		
	}

    @Override
    public void deleteDrugs(String id) {
        drugReferenceMapper.deleteByPrimaryKey(id);
    }
}
